-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Elapsed filter #273
Add Elapsed filter #273
Conversation
I think this implementation has several problems:
|
Hello, any progress on this? Currently implementing a rhythm game using rodio and I'm hitting on this roadblock. Should I go ahead and open a PR utilising RustAudio/cpal#397 instead? |
@JackRedstonia Although there's no direct way to get the elapsed time info, current API already enables us getting it. I'm developing a rhythm game too and already succeeded in implemented precise a/v sync feature. You can see my code in my repository: TonalidadeHidrica/taiko-untitled . By the way if you want to implement this feature you can go ahead, I think. (I'm not an owner of this repo though) |
@TonalidadeHidrica I looked through the code and it seems that it only works for one music track at a time, which isn't exactly what I need, I think. I also tried to add the functionality into the rodio crate for the PR but ended up nuking it all as it was too complex. I believe I should leave this up to someone with better understanding of rodio and cpal. |
@JackRedstonia I agree that current rodio interface is, although quite easy when performing "fuzzy" playback like music player, not really cut out for precise, framewise playback, when you want to build rhythm game or DTM software for example. That's why I only used rodio for decoding several audio data, and write to audio stream with cpal directly by myself. Just for curiosity, what is your specific usecase you thought that my code lacks? (Should I refrain from discussing here?) |
@TonalidadeHidrica I'm making a game framework (which the rhythm game is built on) and I'm looking to have the ability to have any (reasonable) number of tracks playing and to be able to get their playing positions, so I'll have to change quite a lot of things to get that working. Nevertheless, the information about RustAudio/cpal#397 was quite useful, so much thanks for that. |
b10961c
to
a7f67b3
Compare
0ee0413
to
073fdb1
Compare
This has been implemented slightly differently in rodio 0.20 as TrackPosition |
as discussed in #192, a way to get the current elapsed time is almost required for things that are supposed to be synced to the audio (rhythm games for example)
I tried solving this by making a filter, and it appears to work pretty well!
I'm not sure this is the most idiomatic approach to the problem (I'll be honest, not super familiar with rodio, or audio in general for that matter) so if you have any suggestions or better ways to solve this, shoot 😄